
import UIKit
import AFNetworking

//网络请求方式
//枚举在swift中更加强大 可以枚举任何类型

enum HTTPMethod: String {
    case GET = "GET"
    case POST = "POST"
}
//一般网络访问的工具类需要设计成单例
class HTTPClient: AFHTTPSessionManager {

    //定义反转域名
    let domain = "com.baidu.data.error"
    
    static let sharedClient: HTTPClient = {
        let urlString = "https://api.weibo.com/"
        
        let url = NSURL(string: urlString)
        
        let tools = HTTPClient(baseURL: url)
        //设置支持解析的数据类型
        tools.responseSerializer.acceptableContentTypes?.insert("text/plain")
        return tools
    }()
    
    func requestJSONdict (method: HTTPMethod, urlString: String, parameters: [String: AnyObject]?, finished: (dict: [String: AnyObject]?,Error: NSError?) -> ()){
        if method == .GET {
            
        }
    }
}
